﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Besture.Bll;
using Besture.Common;
using Besture.Common.Definition;
using Besture.Model;
using Besture.Utils;
namespace Besture.UI.Control
{
    public partial class RegisterInput : System.Web.UI.UserControl
    {
        public UserDac dac = null;
        public UserModel model = null;
        protected void Page_Load(object sender, EventArgs e)
        {

        }


        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Login_Click(object sender, EventArgs e)
        {
            //验证码
            if (registerCode.Value.ToUpper() != Session["SMSCode"] + "")
            {
                Session["SMSCode"] = null;
                Page.ClientScript.RegisterStartupScript(GetType(), "alertvalidation", "<script>$('#CardError').show();</script>");
                return;
            }
            dac = new UserDac();
            model = new UserModel();
            model.Phone = txtTelphone.Value;
            model.Password = Fun.GetMD5(registerPwd.Value);
            model.CreateBy = 1;
            model.CreateTime = DateTime.Now;
            int flag = dac.Register(model);
            if (flag > 0)
            {
                Fun.Alert("注册成功请登录", "/UserCenter/Login.aspx");
            }

        }
    }
}